<?php
//文件上传
//单文件上传
//var_dump($_FILES["uploadFile"]);
//$filename=iconv("utf-8", "GBK",  "./Uplload/".$_FILES["uploadFile"]["name"]);
//if(move_uploaded_file($_FILES["uploadFile"]["tmp_name"], $filename)){
//	echo "上传成功";
//}else{
//	echo "上传失败";
//}

//多个文件上传
$tmpArr = $_FILES["uploadFile"]["tmp_name"];
$nameArr = $_FILES["uploadFile"]["name"];
$sizeArr = $_FILES["uploadFile"]["size"];
$typeArr = $_FILES["uploadFile"]["type"];
$filnum = 0;
for ($i = 0; $i < count($nameArr); $i++) {
	//判断传送类型为图片
	if (strpos($typeArr[$i], "image") == 0) {
		//判断文件大小500kb
		if ($sizeArr[$i] < 500 * 1024) {
			$filnum++;
			//上传文件的个数
			//重命名文件防止冲突
			$dir = "./Uplload/" . date('ymd');
			if (!is_dir($dir)) {
				mkdir($dir);
			}
			//处理文件名称
			$arr = explode(".", $nameArr[$i]);
			$exp = $arr[count($arr) - 1];
			$filename = md5(time().mt_rand(10000, 100000)) . "." . $exp;
			$filename = iconv("utf-8", "GBK",$dir ."/".$filename);
			move_uploaded_file($tmpArr[$i], $filename);

		}

	}
}
echo "上传成功的文件有",$filnum."个";
?>